home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_18_1987_Transactor_Publishing.d64
/
fac1 facts.pal
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
2KB
|
91 lines
100 rem *** fac1 facts ***
110 rem *** by john houghton ***
120 rem *** collingwood ont ***
130 rem *** august 1986 ***
140 rem
150 rem pal source code
160 rem
170 sys700
180 ;
190 .opt oo
200 ;
210 *= $c000
220 ;
230 ;a routine to demonstrate the use
240 ;of floating point numbers, the
250 ;associated floating point
260 ;accumulators and rom routines.
270 ;
280 lda #$00
290 sta count ;clear integer
300 sta count+1 ;storage
310 lda $7a ;store chrget
320 sta getlo ;pointers
330 lda $7b
340 sta gethi
350 lda #<buffr1 ;point chrget to
360 sta $7a ;1st number
370 lda #>buffr1
380 sta $7b
390 jsr $0079 ;call chr(NULL)t
400 jsr $bcf3 ;ascii to fac1
410 jsr $bbca ;fac1 to mem $57
420 lda #<buffr2 ;point chrget to
430 sta $7a ;2nd number
440 lda #>buffr2
450 sta $7b
460 jsr $0079 ;call chr(NULL)t
470 jsr $bcf3 ;ascii to fac1
480 jsr $bbc7 ;fac1 to mem $5c
490 lda #$57
500 ldy #$00
510 jsr $ba28 ;$57 to fac2 & mult
520 jsr $bbca ;product to $57
530 ;
540 add = *
550 lda #$5c
560 ldy #$00
570 jsr $bba2 ;$5c to fac1
580 ldx $61 ;exponent fac1
590 jsr $b86a ;add fac2 to fac1
600 jsr $bc0f ;sum to fac2
610 inc count ;inc number of
620 bne nex ;additions
630 inc count+1
640 ;
650 nex = *
660 lda #$57
670 ldy #$00
680 jsr $bc5b ;compare sum & prod
690 bmi add ;fac1 < $57
700 jsr $bddd ;fac1 to ascii
710 jsr $ab1e ;print sum
720 lda #$0d
730 jsr $ffd2
740 lda #$57
750 ldy #$00
760 jsr $bba2 ;$57 to fac1
770 jsr $bddd ;fac1 to ascii
780 jsr $ab1e ;print product
790 lda #$0d
800 jsr $ffd2
810 lda count+1 ;get count of
820 ldx count ;additions convert
830 jsr $bdcd ;int to ascii
840 jsr $ab1e ;print count
850 lda getlo
860 sta $7a ;restore chrget
870 lda gethi
880 sta $7b
890 rts
900 ;
910 count *= *+2
920 getlo *= *+1
930 gethi *= *+1
940 ;
950 buffr1 .asc "10.125"
960 .byte $00
970 ;
980 buffr2 .asc "6.375"
990 .byte $00